<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首字母大写</title>
</head>
<body>
<script>
    var str = "helloWorld";
    function f() {
        var s1 = str.substring(0, 1);
        document.write(s1.toUpperCase() + str.substring(1));
    }
    f();
</script>
</body>
</html>